package org.com.service;

import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.com.entity.ConnectionData;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service("connectionDataService")
@Transactional
public class ConnectionDataService {
	
protected static Logger logger = Logger.getLogger("service");
	
	@Resource(name="sessionFactory")
	private SessionFactory sessionFactory;
	

	public void add(String browserName) {
		logger.debug("Adding new person");
		
		// Retrieve session from Hibernate
		Session session = sessionFactory.getCurrentSession();
		
		// Create a new connectionData
		ConnectionData data = new ConnectionData();
		data.setBrowserName(browserName);
		
		// Save
		session.save(data);
	}

}
